<?php
require_once("include/game_core.php");
require_once(GAME_CONTROLLER_FILE);
require_once(USER_CONTROLLER_FILE);

if ( (! UserController::isLoggedIn()) ||
            (! UserController::isPlaying())  ) {
        header( 'Location: index.php' ) ;
    }
    
function handle() {
	$uid = UserController::getUserId();
	if($uid == "") {
		echo "ERROR, cant get uid";
	}

	$command = $_POST['command'];
	
	$gc = new GameController();
	echo $gc->play($command, $uid);
}

handle();
?>